package cn.laixueit.config;

import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
import org.apache.ibatis.reflection.MetaObject;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * @author duxiang
 * @date 2023/12/1 10:58
 */
public class MPAutoConfig implements MetaObjectHandler {
    @Override
    public void insertFill(MetaObject metaObject) {
        setFieldValByName("createTime",new Date(),metaObject);
    }

    @Override
    public void updateFill(MetaObject metaObject) { //这里要和实体类一样
        setFieldValByName("updateTime",new Date(),metaObject);
    }
}
